


	function OpenPSWindow(){

				var box = document.getBoxObjectFor(document.getElementById("photosight-button"));
				var pos = {
					x: (box.screenX + box.width - 510),
					y: (box.screenY + box.height)
				}
			
			var bgWnd = document.getElementById("photosight-bgwnd");
			var phExt = null;
			if(bgWnd){
				var cont = new XPCNativeWrapper(bgWnd.contentWindow).wrappedJSObject;
				if (cont && cont.phExt) 
					phExt = cont.phExt;
			}
				
			wnd = Components.classes['@mozilla.org/embedcomp/window-watcher;1']  
			  .getService(Components.interfaces.nsIWindowWatcher)  
			  .openWindow(window, 'chrome://photosight/content/bubble.xul',  
					  '_blank', 'chrome,dependent=yes,titlebar=no', null);
			wnd.arguments = [pos, phExt];
	}
	
	window.addEventListener("focus",function(){
		if(wnd && !wnd.closed)
			wnd.close();
	},true);
